package com.base.util.javautils.observer;

/**
 * Created by gj on 16-1-27.
 * Observable is used to notify a group of Observer objects when a change
 * occurs. On creation, the set of observers is empty. After a change occurred,
 * the application can call the {@link #notifyObservers()} method. This will
 * cause the invocation of the {@code update()} method of all registered
 * Observers. The order of invocation is not specified. This implementation will
 * call the Observers in the order they registered. Subclasses are completely
 * free in what order they call the update methods.
 *
 * @see IObserver
 */
public interface IObservable extends IObservableController {

    /**
     * Returns the number of observers registered to this {@code Observable}.
     *
     * @return the number of observers.
     */
    int countObservers();

    /**
     * Removes all observers from the list of observers.
     */
    void deleteObservers();

    /**
     * calls the {@code update()}
     * method for every observer in the list of observers using null as the
     * argument.
     * <p/>
     * Equivalent to calling {@code notifyObservers(null)}.
     */
    void notifyObservers();

}
